package com.twu.biblioteca.User;

import java.util.HashMap;
import java.util.Map;

public class UserManager {
    private Map<String, User> userMap = new HashMap<String, User>();

    public boolean add(User user) {
        if (!isExist(user.getAccount())) {
            userMap.put(user.getAccount(), user);
            return true;
        }
        return false;
    }

    public Map<String, User> getUserMap() {
        return userMap;
    }

    public boolean isExist(String account) {
        return userMap.containsKey(account);
    }
}
